<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>11.递归实现倒三角</title>
</head>

<body>
  <script>
    function star (sum = 5) {
      //console.log(document.write('*'.repeat(sum) + '<br/>')); // undefine 所以可以执行 ||后面等代码
      return sum ? document.write('*'.repeat(sum) + '<br/>') || star(--sum)
        : document.write('');
    }
    star();
  </script>
</body>

</html>